﻿@{
    ViewBag.Title = XtremBiking.Recursos.Vistas.Home.Index.Title;
}
 <div class="row-fluid">
     
     <div class="span11">
 @{  
        if(TempData["Message"]!=null)
    	{
    	    <div class="alert alert-success" role="alert" style="text-align:center">
                <a href="#" class="alert-link"><b>@TempData["Message"].ToString()</b></a>
            </div>  
        }
        if (TempData["Error"] != null)
        {
            <div class="alert alert-danger" role="alert" style="text-align:center">
                <a href="#" class="alert-link">@TempData["Error"].ToString()</a>
            </div> 
        } 
        
        if (Request.IsAuthenticated) {
            //MUESTRA EL PROXIMO OBJETIVO
            String[] s = User.Identity.Name.Split(new Char[] { '#' });
            long userId = long.Parse(s[0]);
            List<XtremBiking.Logica.DTO.UserGoal> goals = XtremBiking.Logica.Usuarios.GetUserGoals(userId);
            if(goals!=null){
                XtremBiking.Logica.DTO.UserGoal nextGoal = goals.OrderBy(x => x.Date).FirstOrDefault();
                if (nextGoal.Date.Subtract(DateTime.Today).Days>2){
                    <div class="alert alert-info">
                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                        <h4>@XtremBiking.Recursos.Vistas.Home.Index.GoalMessage.Replace("#Date#",nextGoal.Date.Subtract(DateTime.Today).Days.ToString()).Replace("#Description#",nextGoal.Description)</h4>
                    </div>
                }else
                {
                    <div class="alert alert-success">
                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                        <h4>@XtremBiking.Recursos.Vistas.Home.Index.GoalMessageTomorrow.Replace("#Description#",nextGoal.Description)</h4>
                    </div>
                }
             }
      }
}
      </div>
      </div>
<span class="label label-default"><h1>@XtremBiking.Recursos.Vistas.Home.Index.Legend</h1></span>&nbsp;&nbsp;<h3>@XtremBiking.Recursos.Vistas.Home.Index.SubLegend</h3>
<blockquote>
  <p>@Html.Raw(@XtremBiking.Recursos.Vistas.Home.Index.Body)</p><br/>
</blockquote>
<p>@Html.Raw(@XtremBiking.Recursos.Vistas.Home.Index.Foot)</p>




@*<div class="input-append bootstrap-timepicker">
            <input id="timepicker1" type="text" class="input-small">
            <span class="add-on"><i class="icon-time"></i></span>
        </div>
 
         <script type="text/javascript">
             $('#timepicker1').timepicker({
                 minuteStep: 1,
                 showInputs: false,
                 disableFocus: true,
                 showMeridian: false
                 });
        </script>


<div class="input-append bootstrap-timepicker">
            <input id="timepicker2" type="text" class="input-small">
            <span class="add-on"><i class="icon-time"></i></span>
        </div>
 
         <script type="text/javascript">
             $('#timepicker2').timepicker({
                 minuteStep: 1,
                 showInputs: false,
                 disableFocus: true,
                 showMeridian: true,
                 disableFocus: true
             });
        </script>*@

@*<div class="well">
  <div id="datetimepicker4" class="input-append">
    <input data-format="yyyy-MM-dd" type="text"/>
    <span class="add-on">
      <i data-time-icon="icon-time" data-date-icon="icon-calendar">
      </i>
    </span>
  </div>
</div>
<script type="text/javascript">
    alert("entra");
  $(function() {
      $('#datetimepicker4').DateTimePicker({
      pickTime: false
    });
  });
</script>*@